package com.safeluck.scannerqcr.fragment;

import android.widget.Toast;

import me.yokeyword.fragmentation.SupportFragment;

/**
 * ScannerQCR
 * Created by lzw on 2017/11/28. 17:20:28
 * 邮箱：632393724@qq.com
 * All Rights Saved! Chongqing AnYun Tech co. LTD
 */

public class BaseMainFragment extends SupportFragment {

    private static final long WAIT_TIME = 2000L;
    private long TOUCH_TIME = 0;

    /**
     * 处理回退事件
     * @return
     */
    @Override
    public boolean onBackPressedSupport() {
        if (System.currentTimeMillis()-TOUCH_TIME < WAIT_TIME){
            _mActivity.finish();
        }else{
            TOUCH_TIME = System.currentTimeMillis();
            Toast.makeText(_mActivity,"再按一次退出",Toast.LENGTH_SHORT).show();
        }
        return true;
    }
}
